UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'eprE7DbyF5pa3fLHf/7wDhqvfils3EmFxOwdc47302E='
WHERE
key_id = '97b6e1b3620e57b897ecaedac5b0794b139b12ee18887eb232209d74f8f72a06'
AND (
token = 'eprE7DbyF5pa3fLHf/7wDhqvfils3EmFxOwdc47302E='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)