UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'M/TREh7Biqbkz9z9Dm66wwqf8cBoxCfjHIkBOB/IM+4=' 
WHERE 
  key_id = '49fa30bdf5f0f4be458f099735880cd79b2d9aa9aec167a5ef9aabb27025235f' 
  AND (
    token = 'M/TREh7Biqbkz9z9Dm66wwqf8cBoxCfjHIkBOB/IM+4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037