UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'airilHvuJ4uR6Aod6VNc1BOWJk1RCbCQ40eiUkoZ6Ec='
WHERE
key_id = '9165f07d5a7be0a643b996d73b33738b5fc7f4df7d1e7515bf55fa7bfe854ca1'
AND (
token = 'airilHvuJ4uR6Aod6VNc1BOWJk1RCbCQ40eiUkoZ6Ec='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)