UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '6F2PdZbrphMidRINMJRwuPOxqUI2zjvocyjK9J5s9cE='
WHERE
key_id = 'de3d53dca877bbe38f2c212497ac4ba4fd8c061328f955a1446b7217776a3631'
AND (
token = '6F2PdZbrphMidRINMJRwuPOxqUI2zjvocyjK9J5s9cE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)