UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'tpmZVAva39kzueO0S6kGUZ0qtlcWriaL6a6lkDg9sYA='
WHERE
key_id = '9f94539119b4e8b98d1f40ae176f52325ce1638b5d62163d5aced3f0f30bc3c8'
AND (
token = 'tpmZVAva39kzueO0S6kGUZ0qtlcWriaL6a6lkDg9sYA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)