UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'NZdXh7AGBFdUuyGk0SbJTHZmCT3mTJgCdS8j19MSFs8='
WHERE
key_id = '45dcb835056738f937a37842a3034d1a4fadca44f272d7bdf033c325ad5a3c70'
AND (
token = 'NZdXh7AGBFdUuyGk0SbJTHZmCT3mTJgCdS8j19MSFs8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)