UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'LcYoapM7looEx4OtEn2TuhgnOCC8n1701TK18FuxOjg='
WHERE
key_id = 'a81baabcbb41d697010f0f4ad8e0a45b1a629038f1126fe3f995a5ddec5ada19'
AND (
token = 'LcYoapM7looEx4OtEn2TuhgnOCC8n1701TK18FuxOjg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)