UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'CvvmOgFMWjEMVQJnCWBMMebQ+ZjLOW6Ey4CVMn2ru3Y=' 
WHERE 
  key_id = '3712aea6855fba1624da459ad194d9301ad84c55747516522c1cb08b3a2cc1f3' 
  AND (
    token = 'CvvmOgFMWjEMVQJnCWBMMebQ+ZjLOW6Ey4CVMn2ru3Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037