UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'uzPWM3oMMA0OuoBmEoJ+31AmKMm2Xerq44hu4rrxyRo=' 
WHERE 
  key_id = '43f1306df74b6c676cc6e7771f4724a4b318babdc62f78362b1a921cf50255bc' 
  AND (
    token = 'uzPWM3oMMA0OuoBmEoJ+31AmKMm2Xerq44hu4rrxyRo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026