UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'guQIS/Of6wHAZij1vFvkYwEEiZ4bc7N8+mDmAbE+inY='
WHERE
key_id = '0f2f5f42386918378a67cc90d11e0219eafefcbda0a7f1c6b3f7b5b98d499e9f'
AND (
token = 'guQIS/Of6wHAZij1vFvkYwEEiZ4bc7N8+mDmAbE+inY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)