UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'nc9Xh9SR9GGXaTASX49rgZ8paE4W1C+rMv7AtBz/UIk='
WHERE
key_id = '7e1508d77bd9117ae0f1bf97efb0fc11f8e60fa96cffd7d99201d3cc5ee689d9'
AND (
token = 'nc9Xh9SR9GGXaTASX49rgZ8paE4W1C+rMv7AtBz/UIk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)