UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'C3X9qe5zYfChA3t9rA49L/ibRdckuC8FWCDBbNKV0Ik=' 
WHERE 
  key_id = '20b8880e3ccd4e27e45bcbd18cb1ee0dd700178e8b87302c16b99b8f8b8d8f7a' 
  AND (
    token = 'C3X9qe5zYfChA3t9rA49L/ibRdckuC8FWCDBbNKV0Ik=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023