UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Ejd2cmRy92Jh7RG7ycAKL+h/GCwm9h2CKOTmr5cO3Uc=' 
WHERE 
  key_id = 'edab996ec1403d7ba3b244fbf899c536845611af19bae2a95b369c9df133e4ef' 
  AND (
    token = 'Ejd2cmRy92Jh7RG7ycAKL+h/GCwm9h2CKOTmr5cO3Uc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00088