UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'aaJX5ABvXntotHobTGJM5qDNrjJWA8vCzJQEDoZimxk='
WHERE
key_id = '3b2d7ebc47bffaeb0da9eedb841a75f00536a35244cd501295efb45a3845ebf8'
AND (
token = 'aaJX5ABvXntotHobTGJM5qDNrjJWA8vCzJQEDoZimxk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)