UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'wS57jj5WaCtRlwlG617yz4yvjIsYY81xmVMhOUrxx9A='
WHERE
key_id = '34a4e8ba4717918a40fd066a40c88fa21d6ccd0d2f36513b002e54366beeede8'
AND (
token = 'wS57jj5WaCtRlwlG617yz4yvjIsYY81xmVMhOUrxx9A='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)