UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KjWCp+zgJGj9KUZ9kvGhnXIoVT89pjZE6Vq/weu+W+I=' 
WHERE 
  key_id = '87b3a81ee149d53cc0c6122866d0dbd6be00049c1b5ac24fa5f40adf0efbfaa1' 
  AND (
    token = 'KjWCp+zgJGj9KUZ9kvGhnXIoVT89pjZE6Vq/weu+W+I=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035