UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'zB4aBqcKeVCVmphfD9hRARMJdPta9Urv2vMdqjGBVD8='
WHERE
key_id = '08c652df732cf3801487a6560ea0615b22b057701fcab0f659446d7bb1626e06'
AND (
token = 'zB4aBqcKeVCVmphfD9hRARMJdPta9Urv2vMdqjGBVD8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)