UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'fNCgM3Blm7FpZ2SEiTLBAgfj+3CNOSOfpRknhpffyE8=' 
WHERE 
  key_id = '1041ea00b87e5af939e340a44da171c1e6f06311ac3c8ce185f8a7243bf7af49' 
  AND (
    token = 'fNCgM3Blm7FpZ2SEiTLBAgfj+3CNOSOfpRknhpffyE8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036