UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'hoMc1Wszjh7/wHONOeWD8+mI2i6H0+vYYEiTQ8r5IG8=' 
WHERE 
  key_id = '52604978a8a17c96b6ce21e529d87ce92fc92d502d603c95a04cdf42de68be3c' 
  AND (
    token = 'hoMc1Wszjh7/wHONOeWD8+mI2i6H0+vYYEiTQ8r5IG8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020