UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'YgtjaB4zd8dRj5SFRSWY7e5vXvdyVGmhoTcwQ7UfXTc='
WHERE
key_id = '950502075a60c49c717c4e7acba21df81fcc468c54f8ffeb1f9a52988fb81047'
AND (
token = 'YgtjaB4zd8dRj5SFRSWY7e5vXvdyVGmhoTcwQ7UfXTc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)