UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'v2NBz3I4PackHd8NC7ryurkax/uOsomzxF85swPGcuM=' 
WHERE 
  key_id = '7b0afad25a3e70efdeaeb860cff0e8d1dac23efbd4f1ff850fc1dd0eaf10d6c2' 
  AND (
    token = 'v2NBz3I4PackHd8NC7ryurkax/uOsomzxF85swPGcuM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032