UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gSpF/DqAz/JRaxkTVB3v4tcE+OV5W6yIX17g2ipoMDk=' 
WHERE 
  key_id = '8b33a3e76b4f3babc0a0baedc2088d2db20ca17f4500c31791a65d989223d0b3' 
  AND (
    token = 'gSpF/DqAz/JRaxkTVB3v4tcE+OV5W6yIX17g2ipoMDk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042