UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Xs3vZWjb3ONhmr+sVKKz5KWYmlvgC3unbz9Rp4i4l+Q=' 
WHERE 
  key_id = '8ed485eedc656b5e90f2d2373a7f4cdc2c84c08284ead69425e9709d33051464' 
  AND (
    token = 'Xs3vZWjb3ONhmr+sVKKz5KWYmlvgC3unbz9Rp4i4l+Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00051