UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'd1qBAEuo3SLoHhPgLI8CrxIJmP/aOS0g9wATH8seVj4='
WHERE
key_id = 'eebfb6d470790642f052a4d62a2bac332fb503841ed1874b7548ba11430792a2'
AND (
token = 'd1qBAEuo3SLoHhPgLI8CrxIJmP/aOS0g9wATH8seVj4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)