UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'mlm0DvqwwU1neYluseUSs8e+XfxiRDiLq8+LHJSBaXc=' 
WHERE 
  key_id = '82cc4c7d05b441561e844ad4a53364bd924ecc88511c982f9d6fa8e45c1950e8' 
  AND (
    token = 'mlm0DvqwwU1neYluseUSs8e+XfxiRDiLq8+LHJSBaXc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00052