UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'SAvSJmLW9g1jxJpTQu20HqprvHJZiIzbF/gdZTtNRg4='
WHERE
key_id = '904ae0a684d94c421bcba32dcf4d783be4c0f50960ab523f68025bdfb8e2b0df'
AND (
token = 'SAvSJmLW9g1jxJpTQu20HqprvHJZiIzbF/gdZTtNRg4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)