UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'cScNDbv0/PNCsgSFEE3VADvWWEg1yAikrKa7D14pXX4=' 
WHERE 
  key_id = 'bfacd85943a840ee20dc45fb76e12d068614d39049dcab7e5922b3f7776e620f' 
  AND (
    token = 'cScNDbv0/PNCsgSFEE3VADvWWEg1yAikrKa7D14pXX4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040