UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'OsY0zjxhOvAnTehY/E0bomASAXuKcB0skTmn+K+pEzU='
WHERE
key_id = '5ec1a6883d374ef26617e872c4beeb07a3b417704eacbe0c5f1ed5c44c22c038'
AND (
token = 'OsY0zjxhOvAnTehY/E0bomASAXuKcB0skTmn+K+pEzU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)