UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'qj43a/ZpKp8h9MIMU8ZGnpV4BTvWNsPhE2UohYMCx4Y='
WHERE
key_id = 'd118bd7c0b5d9882f90c5c7067a37dc5d3cc52bc9c6afeeb77e5ecaa79d96323'
AND (
token = 'qj43a/ZpKp8h9MIMU8ZGnpV4BTvWNsPhE2UohYMCx4Y='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)