UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'WGk9JtyX+XvU43KHqCUCdmSdI8eeEN9FfKfU7DXy+I8='
WHERE
key_id = 'b2a32ccfa0d175b78b317d2e23680e2fe5c260a982dfea6f242cdaa1b6426bd4'
AND (
token = 'WGk9JtyX+XvU43KHqCUCdmSdI8eeEN9FfKfU7DXy+I8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)