UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'xX32I4f+PIAjbDeg39L3WNy9sUPwFpNCYfP7kndd79M='
WHERE
key_id = '58bb794fffb6f2eface0ade38b8a567f11a16aeaed8978e1356dd09a0746fd1e'
AND (
token = 'xX32I4f+PIAjbDeg39L3WNy9sUPwFpNCYfP7kndd79M='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)