UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'RQjhzXSfa7xgqSX42+VY6qKJRufeF1aGoq1sY1w9Obs='
WHERE
key_id = '832ea20bea02cff28d18cd352cc8c2aa28b7d0e8d918a6a6c3563f2f16a3f8cb'
AND (
token = 'RQjhzXSfa7xgqSX42+VY6qKJRufeF1aGoq1sY1w9Obs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)