UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '6kaEnYS8Iu3Ush616antStjO0ZC9no3p46n1ZlkKLZU=' 
WHERE 
  key_id = 'd5603cd89a143dd69e84eb87fce90c62035d78da876c98af83a0bcf06027503e' 
  AND (
    token = '6kaEnYS8Iu3Ush616antStjO0ZC9no3p46n1ZlkKLZU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046