UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'lHrpNSJN80BOc8ebvsscGpGNqhAeqn8HTk1dLjFfcVc='
WHERE
key_id = 'b9b30384c23d39f5fc01687f23b3ebe108609d71c92ef3e8aa5a6e4bd750a86c'
AND (
token = 'lHrpNSJN80BOc8ebvsscGpGNqhAeqn8HTk1dLjFfcVc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)