UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'dVAbadQVRLqm2Tto1qKKuNoL0V2Vg3+XboBSQcAutog='
WHERE
key_id = '8b9412d5325bf08fb53dbfa337fc3e2a4201e2b9ec2614395b317723deedfef5'
AND (
token = 'dVAbadQVRLqm2Tto1qKKuNoL0V2Vg3+XboBSQcAutog='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)