UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'l3wb718hbQbSvouAe+JCKg+Gm5eHSCuDsb7hZunOpws=' 
WHERE 
  key_id = '26afda95729139e594ea2403581e000a58334138d4af4c316c3d5379e19697a8' 
  AND (
    token = 'l3wb718hbQbSvouAe+JCKg+Gm5eHSCuDsb7hZunOpws=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028