UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gq6Ed9aqYFLfWmWFL5w+LKFoeNjWBQwSzK5J02HXLoc=' 
WHERE 
  key_id = '1df9e1f50f87f48b618b0ce1dce242765eed251490651306985b2562cb7f7717' 
  AND (
    token = 'gq6Ed9aqYFLfWmWFL5w+LKFoeNjWBQwSzK5J02HXLoc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050