UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'GPAjm2APv1Ov1I2I3Kf4JtPPSOdk0S6lixhIjGlieyo=' 
WHERE 
  key_id = '2f4a8363ff0357d78a1d16830c5cfabc87cee92b057f3d5b51f56854d751f723' 
  AND (
    token = 'GPAjm2APv1Ov1I2I3Kf4JtPPSOdk0S6lixhIjGlieyo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044