UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '1QuCAAsXQaPap0XiI35GUcqlOKvVhIqvZyhYK2HPB2Y='
WHERE
key_id = 'ed474ac7d32b9173097106511a9238f98899c936b1a8ee62e68ecbd624f76f62'
AND (
token = '1QuCAAsXQaPap0XiI35GUcqlOKvVhIqvZyhYK2HPB2Y='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)