UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ffvM+VrcF7yyRzuVLvYbnS0cOd46+hXihvjAbeOFlAo=' 
WHERE 
  key_id = 'e760c1dbd968ce75bb98584ecb17353dc5d6c2606d2cb5829c20bfe53f3c170a' 
  AND (
    token = 'ffvM+VrcF7yyRzuVLvYbnS0cOd46+hXihvjAbeOFlAo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00018