UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'zsDS7pdyL0k6ty/DaIpA5dKPv8qvaGkfggwCpZ0KCyI='
WHERE
key_id = '514111ed98f53b22320b21c09edee8c353bf4b0776e74adb4b55525377a7abcf'
AND (
token = 'zsDS7pdyL0k6ty/DaIpA5dKPv8qvaGkfggwCpZ0KCyI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)