UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'qlGhKZ/z3wdoFrIQjpSER1DARsGzdSBO7V2uvYUxHCM=' 
WHERE 
  key_id = 'fa59c657bc4dbe96ca735df2f0aa610ec134207f3b88b9d3806a1d7e0fb35995' 
  AND (
    token = 'qlGhKZ/z3wdoFrIQjpSER1DARsGzdSBO7V2uvYUxHCM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020