UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'y5621oQTo7H2XN5pTlNStLukbUttWQqWVfBauly8BQ4=' 
WHERE 
  key_id = '8fb4b9bb1bc3a56cd553648a327fa0034c9e7e1f9a6e7158149eb186bf27ca62' 
  AND (
    token = 'y5621oQTo7H2XN5pTlNStLukbUttWQqWVfBauly8BQ4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030