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