UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'tWPgfj7N9dlb0m2vITmezbu2ZD12O8IFoPSb+xljRyM='
WHERE
key_id = 'fa684f4c473a8913f0aa79bd6f5452e7c2bcfbf954afecd264d6df8bef6ca94d'
AND (
token = 'tWPgfj7N9dlb0m2vITmezbu2ZD12O8IFoPSb+xljRyM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)