UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'J3fEHGuVJTZHKPZzcUDu+prkbIfS9cOyPYjaVAoe4M4='
WHERE
key_id = 'a3b0ae1bbab6d102154c73deb546821a2b58f92aefac2eaf047c0d00c024aa8a'
AND (
token = 'J3fEHGuVJTZHKPZzcUDu+prkbIfS9cOyPYjaVAoe4M4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)