UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'alt0d3e3vz4r5awwu+HzalTYZFK/RVZIoCsbOIGYeus='
WHERE
key_id = '3e9e54e6bdd4b20f043a8366f0f6890e8c8bd3cc63805978deb233fb7eb4e07e'
AND (
token = 'alt0d3e3vz4r5awwu+HzalTYZFK/RVZIoCsbOIGYeus='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)