UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'YkrYYOvonUrvIZlPGci+3nex2xMeGQgDCdrCA6EuYN4='
WHERE
key_id = '7ff03f9d20b4e915cb8573b9cc876656dd6e4b010c8226e2faebcd124f6b86e5'
AND (
token = 'YkrYYOvonUrvIZlPGci+3nex2xMeGQgDCdrCA6EuYN4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)