UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'WZLbswm3OWTpDwhs+MGhLYCxf88U3nGB4dfn2mu8k5w=' 
WHERE 
  key_id = '38f738111258188028f87602ced1b6f6735c094df288c30e95d476c51cce91ad' 
  AND (
    token = 'WZLbswm3OWTpDwhs+MGhLYCxf88U3nGB4dfn2mu8k5w=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00053