UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'q+2GaYGRDRlZp97l3JzN23FKy0O9jZqb/5qCKQbsvag=' 
WHERE 
  key_id = '13d6a1c39619c75b73b6a91c882dbc1b918b7a8db51366cc6a99621dffc13d14' 
  AND (
    token = 'q+2GaYGRDRlZp97l3JzN23FKy0O9jZqb/5qCKQbsvag=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043